//
//  GesturesToLockController.m
//  newTestGit
//
//  Created by fangjs on 16/2/19.
//  Copyright © 2016年 Hongshi. All rights reserved.
//

#import "GesturesToLockController.h"
//#import "JKLockView.h"
@interface GesturesToLockController () <JKLockViewDelegate>
//@property (weak, nonatomic) IBOutlet UIButton *changePassword;
//@property (weak, nonatomic) IBOutlet UIButton *forgetPassword;
@property (weak, nonatomic) IBOutlet UIImageView *showStatus;
@property (strong , nonatomic) NSString *password;

@end

@implementation GesturesToLockController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void) lockView:(JKLockView *)lockView didFinishPath:(NSString *)path {
    NSLog(@"222");
    NSUserDefaults *user = [NSUserDefaults standardUserDefaults];
    self.password = [user objectForKey:KEY_CURRENT_UID];
    NSLog(@"self.password = %@",self.password);
    if (![path isEqualToString:self.password]) {
        UIAlertController *alter = [UIAlertController alertControllerWithTitle:@"密码错误" message:@"请重新尝试" preferredStyle:UIAlertControllerStyleAlert];
        UIAlertAction *OK = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDestructive handler:nil];
        UIAlertAction *Cancle = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil];
        
        [alter addAction:OK];
        [alter addAction:Cancle];
        [self presentViewController:alter animated:YES completion:nil];
    }
    else
    {        
         [self dismissViewControllerAnimated:YES completion:nil];
    }
}

- (IBAction)backBtn:(id)sender {
    [self dismissViewControllerAnimated:YES completion:nil];
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
